home *** CD-ROM | disk | FTP | other *** search
/ Aminet 25 / Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso / Aminet / comm / tcp / rxsocket.lha / reclient.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1998-04-05  |  556 b   |  40 lines

  1. /*
  2.     client per reserv
  3. */
  4.  
  5.  
  6. if host="" then do
  7.     say "Usage: reclient"
  8.     exit
  9. end
  10.  
  11. sin.ADDRFAMILY = "INET"
  12. sin.ADDRPORT   = 4000
  13. sin.ADDRADDR   = inetaddr('127.0.0.1')
  14.  
  15. sock=socket("INET","STREAM","IP")
  16. if sock<0 then do
  17.     say "no socket:" Errno()
  18.     exit
  19. end
  20.  
  21. if connect(sock,"SIN") < 0 then do
  22.     say "connect:" Errno()
  23.     exit
  24. end
  25.  
  26. REQUEST = "reverse service test"
  27. res = send(sock,REQUEST)
  28. if res ~= length(REQUEST) then do
  29.     say "send:"  Errno()
  30.     exit
  31. end
  32.  
  33. len = recv(sock,"BUF",256)
  34. if len<0 then do
  35.     say "recv:" Errno()
  36.     exit
  37. end
  38. say buf
  39. call closesocket(sock)
  40.